/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.fontbox.cff;

/**
 * This is specialized CFFEncoding. It's used if the EncodingId of a font is set to 1.
 * 
 * @author Villu Ruusmann
 */
public final class CFFExpertEncoding extends CFFEncoding
{
    
    private static final int CHAR_CODE = 0;
    private static final int CHAR_SID = 1;

    private CFFExpertEncoding()
    {
        // Table of character codes and their corresponding sid.
        int[][] cffExpertEncodingTable = {
                {0, 0},
                {1, 0},
                {2, 0},
                {3, 0},
                {4, 0},
                {5, 0},
                {6, 0},
                {7, 0},
                {8, 0},
                {9, 0},
                {10, 0},
                {11, 0},
                {12, 0},
                {13, 0},
                {14, 0},
                {15, 0},
                {16, 0},
                {17, 0},
                {18, 0},
                {19, 0},
                {20, 0},
                {21, 0},
                {22, 0},
                {23, 0},
                {24, 0},
                {25, 0},
                {26, 0},
                {27, 0},
                {28, 0},
                {29, 0},
                {30, 0},
                {31, 0},
                {32, 1},
                {33, 229},
                {34, 230},
                {35, 0},
                {36, 231},
                {37, 232},
                {38, 233},
                {39, 234},
                {40, 235},
                {41, 236},
                {42, 237},
                {43, 238},
                {44, 13},
                {45, 14},
                {46, 15},
                {47, 99},
                {48, 239},
                {49, 240},
                {50, 241},
                {51, 242},
                {52, 243},
                {53, 244},
                {54, 245},
                {55, 246},
                {56, 247},
                {57, 248},
                {58, 27},
                {59, 28},
                {60, 249},
                {61, 250},
                {62, 251},
                {63, 252},
                {64, 0},
                {65, 253},
                {66, 254},
                {67, 255},
                {68, 256},
                {69, 257},
                {70, 0},
                {71, 0},
                {72, 0},
                {73, 258},
                {74, 0},
                {75, 0},
                {76, 259},
                {77, 260},
                {78, 261},
                {79, 262},
                {80, 0},
                {81, 0},
                {82, 263},
                {83, 264},
                {84, 265},
                {85, 0},
                {86, 266},
                {87, 109},
                {88, 110},
                {89, 267},
                {90, 268},
                {91, 269},
                {92, 0},
                {93, 270},
                {94, 271},
                {95, 272},
                {96, 273},
                {97, 274},
                {98, 275},
                {99, 276},
                {100, 277},
                {101, 278},
                {102, 279},
                {103, 280},
                {104, 281},
                {105, 282},
                {106, 283},
                {107, 284},
                {108, 285},
                {109, 286},
                {110, 287},
                {111, 288},
                {112, 289},
                {113, 290},
                {114, 291},
                {115, 292},
                {116, 293},
                {117, 294},
                {118, 295},
                {119, 296},
                {120, 297},
                {121, 298},
                {122, 299},
                {123, 300},
                {124, 301},
                {125, 302},
                {126, 303},
                {127, 0},
                {128, 0},
                {129, 0},
                {130, 0},
                {131, 0},
                {132, 0},
                {133, 0},
                {134, 0},
                {135, 0},
                {136, 0},
                {137, 0},
                {138, 0},
                {139, 0},
                {140, 0},
                {141, 0},
                {142, 0},
                {143, 0},
                {144, 0},
                {145, 0},
                {146, 0},
                {147, 0},
                {148, 0},
                {149, 0},
                {150, 0},
                {151, 0},
                {152, 0},
                {153, 0},
                {154, 0},
                {155, 0},
                {156, 0},
                {157, 0},
                {158, 0},
                {159, 0},
                {160, 0},
                {161, 304},
                {162, 305},
                {163, 306},
                {164, 0},
                {165, 0},
                {166, 307},
                {167, 308},
                {168, 309},
                {169, 310},
                {170, 311},
                {171, 0},
                {172, 312},
                {173, 0},
                {174, 0},
                {175, 313},
                {176, 0},
                {177, 0},
                {178, 314},
                {179, 315},
                {180, 0},
                {181, 0},
                {182, 316},
                {183, 317},
                {184, 318},
                {185, 0},
                {186, 0},
                {187, 0},
                {188, 158},
                {189, 155},
                {190, 163},
                {191, 319},
                {192, 320},
                {193, 321},
                {194, 322},
                {195, 323},
                {196, 324},
                {197, 325},
                {198, 0},
                {199, 0},
                {200, 326},
                {201, 150},
                {202, 164},
                {203, 169},
                {204, 327},
                {205, 328},
                {206, 329},
                {207, 330},
                {208, 331},
                {209, 332},
                {210, 333},
                {211, 334},
                {212, 335},
                {213, 336},
                {214, 337},
                {215, 338},
                {216, 339},
                {217, 340},
                {218, 341},
                {219, 342},
                {220, 343},
                {221, 344},
                {222, 345},
                {223, 346},
                {224, 347},
                {225, 348},
                {226, 349},
                {227, 350},
                {228, 351},
                {229, 352},
                {230, 353},
                {231, 354},
                {232, 355},
                {233, 356},
                {234, 357},
                {235, 358},
                {236, 359},
                {237, 360},
                {238, 361},
                {239, 362},
                {240, 363},
                {241, 364},
                {242, 365},
                {243, 366},
                {244, 367},
                {245, 368},
                {246, 369},
                {247, 370},
                {248, 371},
                {249, 372},
                {250, 373},
                {251, 374},
                {252, 375},
                {253, 376},
                {254, 377},
                {255, 378}
        };

        for (int[] encodingEntry : cffExpertEncodingTable)
        {
            add(encodingEntry[CHAR_CODE], encodingEntry[CHAR_SID]);
        }
    }

    /**
     * Returns an instance of the CFFExportEncoding class.
     * @return an instance of CFFExportEncoding
     */
    public static CFFExpertEncoding getInstance()
    {
        return CFFExpertEncoding.INSTANCE;
    }

    private static final CFFExpertEncoding INSTANCE = new CFFExpertEncoding();

}
